package com.controller;

import com.bean.Seat;
import com.service.SeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Component
@Controller
@RequestMapping("add")
public class AddController {

    @Autowired
    private SeatService seatService;

    @RequestMapping("add1")
    public void add1(Seat seat){

        for (int i = 0; i <12 ; i++) {
            for (int j = 0; j <29 ; j++) {
                seat.setCinemaId(1);
                seat.setRows(i+1);
                seat.setNumber(j+1);
                seat.setState(0);
                seat.setFilmsId("1");
                seatService.save(seat);
            }
        }
        System.out.println("添加1号厅座位成功");
    }
    @RequestMapping("add2")
    public void add2(Seat seat){

        for (int i = 0; i <11 ; i++) {
            for (int j = 0; j <17 ; j++) {
                seat.setCinemaId(2);
                seat.setRows(i+1);
                seat.setNumber(j+1);
                seat.setState(0);
                seat.setFilmsId("3");
                seatService.save(seat);
            }
        }
        System.out.println("添加2号厅座位成功");
    }
    @RequestMapping("add3")
    public void add3(Seat seat){

        for (int i = 0; i <11 ; i++) {
            for (int j = 0; j <17 ; j++) {
                seat.setCinemaId(3);
                seat.setRows(i+1);
                seat.setNumber(j+1);
                seat.setState(0);
                seat.setFilmsId("4");
                seatService.save(seat);
            }
        }
        System.out.println("添加3号厅座位成功");
    }
    @RequestMapping("add4")
    public void add4(Seat seat){

        for (int i = 0; i <11 ; i++) {
            for (int j = 0; j <17 ; j++) {
                seat.setCinemaId(4);
                seat.setRows(i+1);
                seat.setNumber(j+1);
                seat.setState(0);
                seatService.save(seat);
            }
        }
        System.out.println("添加4号厅座位成功");
    }
    @RequestMapping("add5")
    public void add5(Seat seat){

        for (int i = 0; i <11 ; i++) {
            for (int j = 0; j <17 ; j++) {
                seat.setCinemaId(5);
                seat.setRows(i+1);
                seat.setNumber(j+1);
                seat.setState(0);
                seatService.save(seat);
            }
        }
        System.out.println("添加5号厅座位成功");
    }
    @RequestMapping("add6")
    public void add6(Seat seat){

        for (int i = 0; i <12 ; i++) {
            for (int j = 0; j <29 ; j++) {
                seat.setCinemaId(6);
                seat.setRows(i+1);
                seat.setNumber(j+1);
                seat.setState(0);
                seat.setFilmsId("2");
                seatService.save(seat);
            }
        }
        System.out.println("添加6号厅座位成功");
    }

}
